// Copyright 2024 The MediaPipe Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <Foundation/Foundation.h>
#import "mediapipe/tasks/ios/components/containers/sources/MPPClassificationResult.h"
#import "mediapipe/tasks/ios/components/containers/sources/MPPLandmark.h"
#import "mediapipe/tasks/ios/core/sources/MPPTaskResult.h"
#import "mediapipe/tasks/ios/vision/core/sources/MPPMask.h"

NS_ASSUME_NONNULL_BEGIN

/** Represents holistic landmarks detection results generated by `HolisticLandmarker`. */
NS_SWIFT_NAME(HolisticLandmarkerResult)
@interface MPPHolisticLandmarkerResult : MPPTaskResult

/** Detected face landmarks in normalized image coordinates. */
@property(nonatomic, readonly) NSArray<NSArray<MPPNormalizedLandmark *> *> *faceLandmarks;

/** Face blendshapes results. Defaults to `nil` if not enabled. */
@property(nonatomic, readonly, nullable) NSArray<MPPClassifications *> *faceBlendshapes;

/** Detected pose landmarks in normalized image coordinates. */
@property(nonatomic, readonly) NSArray<NSArray<MPPNormalizedLandmark *> *> *poseLandmarks;

/** Pose landmarks in world coordinates of detected poses. */
@property(nonatomic, readonly) NSArray<NSArray<MPPLandmark *> *> *poseWorldLandmarks;

/** Optional segmentation mask for the detected pose. Defaults to `nil` if not enabled.*/
@property(nonatomic, readonly, nullable) NSArray<MPPMask *> *poseSegmentationMasks;

/** Left hand landmarks in normalized image coordinates of detected left hands. */
@property(nonatomic, readonly) NSArray<NSArray<MPPNormalizedLandmark *> *> *leftHandLandmarks;

/** Left hand landmarks in world coordinates of detected left hands. */
@property(nonatomic, readonly) NSArray<NSArray<MPPLandmark *> *> *leftHandWorldLandmarks;

/** Right hand landmarks in normalized image coordinates of detected right hands. */
@property(nonatomic, readonly) NSArray<NSArray<MPPNormalizedLandmark *> *> *rightHandLandmarks;

/** Right hand landmarks in world coordinates of detected right hands. */
@property(nonatomic, readonly) NSArray<NSArray<MPPLandmark *> *> *rightHandWorldLandmarks;

/**
 * Initializes a new `HolisticLandmarkerResult` with the given array of face landmarks, face
 * blendshapes, pose landmarks, pose world landmarks, pose segmentation masks, left hand landmarks,
 * left hand world landmarks, right hand landmarks, right hand world landmarks and timestamp (in
 * milliseconds).
 *
 * @param faceLandmarks An array of `NormalizedLandmark` objects.
 * @param faceBlendshapes An array of `Classifications` objects.
 * @param poseLandmarks An array of `NormalizedLandmark` objects.
 * @param poseWorldLandmarks An array of `Landmark` objects.
 * @param poseSegmentationMasks An array of `Mask` objects.
 * @param leftHandLandmarks An array of `NormalizedLandmark` objects.
 * @param leftHandWorldLandmarks An array of `Landmark` objects.
 * @param rightHandLandmarks An array of `NormalizedLandmark` objects.
 * @param rightHandWorldLandmarks An array of `Landmark` objects.
 * @param timestampInMilliseconds The timestamp (in milliseconds) for this result.
 *
 * @return An instance of `HolisticLandmarkerResult` initialized with the given array of face
 * landmarks, face blendshapes, pose landmarks, pose world landmarks, pose segmentation masks, left
 * hand landmarks, left hand world landmarks, right hand landmarks, right hand world landmarks and
 * timestamp (in milliseconds).
 */
- (instancetype)
      initWithFaceLandmarks:(NSArray<NSArray<MPPNormalizedLandmark *> *> *)faceLandmarks
            faceBlendshapes:(nullable NSArray<MPPClassifications *> *)faceBlendshapes
              poseLandmarks:(NSArray<NSArray<MPPNormalizedLandmark *> *> *)poseLandmarks
         poseWorldLandmarks:(NSArray<NSArray<MPPLandmark *> *> *)poseWorldLandmarks
      poseSegmentationMasks:(NSArray<MPPMask *> *)poseSegmentationMasks
          leftHandLandmarks:(NSArray<NSArray<MPPNormalizedLandmark *> *> *)leftHandLandmarks
     leftHandWorldLandmarks:(NSArray<NSArray<MPPLandmark *> *> *)leftHandWorldLandmarks
         rightHandLandmarks:(NSArray<NSArray<MPPNormalizedLandmark *> *> *)rightHandLandmarks
    rightHandWorldLandmarks:(NSArray<NSArray<MPPLandmark *> *> *)rightHandWorldLandmarks
    timestampInMilliseconds:(NSInteger)timestampInMilliseconds NS_DESIGNATED_INITIALIZER;

- (instancetype)initWithTimestampInMilliseconds:(NSInteger)timestampInMilliseconds NS_UNAVAILABLE;

- (instancetype)init NS_UNAVAILABLE;

+ (instancetype)new NS_UNAVAILABLE;

@end

NS_ASSUME_NONNULL_END
